package com.ruoyi.extensionmonitor.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.extensionmonitor.domain.InfoExtensionMonitorTargetDetail;
import com.ruoyi.extensionmonitor.service.IInfoExtensionMonitorTargetDetailService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 延伸监控详情Controller
 * 
 * @author ruoyi
 * @date 2022-12-05
 */
@RestController
@RequestMapping("/extensionmonitor/extensionmonitordetail")
public class InfoExtensionMonitorTargetDetailController extends BaseController
{
    @Autowired
    private IInfoExtensionMonitorTargetDetailService infoExtensionMonitorTargetDetailService;

    /**
     * 查询延伸监控详情列表
     */
    @PreAuthorize("@ss.hasPermi('extensionmonitor:extensionmonitordetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(InfoExtensionMonitorTargetDetail infoExtensionMonitorTargetDetail)
    {
        startPage();
        List<InfoExtensionMonitorTargetDetail> list = infoExtensionMonitorTargetDetailService.selectInfoExtensionMonitorTargetDetailList(infoExtensionMonitorTargetDetail);
        return getDataTable(list);
    }

    /**
     * 导出延伸监控详情列表
     */
    @PreAuthorize("@ss.hasPermi('extensionmonitor:extensionmonitordetail:export')")
    @Log(title = "延伸监控详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, InfoExtensionMonitorTargetDetail infoExtensionMonitorTargetDetail)
    {
        List<InfoExtensionMonitorTargetDetail> list = infoExtensionMonitorTargetDetailService.selectInfoExtensionMonitorTargetDetailList(infoExtensionMonitorTargetDetail);
        ExcelUtil<InfoExtensionMonitorTargetDetail> util = new ExcelUtil<InfoExtensionMonitorTargetDetail>(InfoExtensionMonitorTargetDetail.class);
        util.exportExcel(response, list, "延伸监控详情数据");
    }

    /**
     * 获取延伸监控详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('extensionmonitor:extensionmonitordetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(infoExtensionMonitorTargetDetailService.selectInfoExtensionMonitorTargetDetailById(id));
    }

    /**
     * 新增延伸监控详情
     */
    @PreAuthorize("@ss.hasPermi('extensionmonitor:extensionmonitordetail:add')")
    @Log(title = "延伸监控详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody InfoExtensionMonitorTargetDetail infoExtensionMonitorTargetDetail)
    {
        return toAjax(infoExtensionMonitorTargetDetailService.insertInfoExtensionMonitorTargetDetail(infoExtensionMonitorTargetDetail));
    }

    /**
     * 修改延伸监控详情
     */
    @PreAuthorize("@ss.hasPermi('extensionmonitor:extensionmonitordetail:edit')")
    @Log(title = "延伸监控详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody InfoExtensionMonitorTargetDetail infoExtensionMonitorTargetDetail)
    {
        return toAjax(infoExtensionMonitorTargetDetailService.updateInfoExtensionMonitorTargetDetail(infoExtensionMonitorTargetDetail));
    }

    /**
     * 删除延伸监控详情
     */
    @PreAuthorize("@ss.hasPermi('extensionmonitor:extensionmonitordetail:remove')")
    @Log(title = "延伸监控详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(infoExtensionMonitorTargetDetailService.deleteInfoExtensionMonitorTargetDetailByIds(ids));
    }
}
